package org.jash.learnmvp.net;

import org.jash.learnmvp.entity.CategoryEntity;
import org.jash.learnmvp.entity.CodeEntity;
import org.jash.learnmvp.entity.CommentEntity;
import org.jash.learnmvp.entity.LoginEntity;
import org.jash.learnmvp.entity.NewsDetailEntity;
import org.jash.learnmvp.entity.NewsEntity;
import org.jash.learnmvp.entity.NewsPageEntity;
import org.jash.learnmvp.entity.Res;
import org.jash.learnmvp.entity.VideoEntity;

import java.util.Map;

import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface ApiService {
    @POST("/api/user/loginname")
    Observable<LoginEntity> login(@Body Map<String, String> user);
    @GET("/api/sms/sendlcode")
    Observable<CodeEntity> getLCode(@Query("phone") String phone);
    @GET("/api/sms/sendrcode")
    Observable<CodeEntity> getRCode(@Query("phone") String phone);
    @POST("/api/user/logincode")
    Observable<LoginEntity> codeLogin(@Body Map<String, String> code);
    @GET("/api/user/loginout")
    Observable<LoginEntity> logout();
    @POST("/api/sms/checkrcode")
    Observable<Res> verifyRegister(@Body Map<String, String> map);
    @POST("/api/user/register")
    Observable<Res> register(@Body Map<String, String> user);
    @GET("/api/news/tophot")
    Observable<NewsEntity> getTopHot();
    @GET("/api/nt/all")
    Observable<CategoryEntity> getNewsCategory();
    @GET("/api/news/page")
    Observable<NewsPageEntity> getNewsByCategory(@Query("type") int type, @Query("page") int page, @Query("size") int size);
    @GET("/api/news/detail")
    Observable<NewsDetailEntity> getNewsDetail(@Query("id") int id);
    @GET("/api/newsComment/comments")
    Observable<CommentEntity> getComments(@Query("nid") int id);
    @POST("/api/newsComment/save")
    Observable<Res> sendComment(@Body Map<String, Object> map);
    @GET("/api/video/all")
    Observable<VideoEntity> getAllVideo();
}
